<?php
/**
 * 旅馆管理
 *
 * @copyright Copyright © 2008 harry
 * @author harry 
 * @subpackage room
 * 
 */
FLEA::loadClass('admin_AdminAbstract');
class controller_FrontAdminHotel extends admin_AdminAbstract
{
	/**
	 * 城市
	 *
	 * @var unknown_type
	 */
	var $hotel;
	
	function __construct()
	{
		parent::__construct();
		$this->hotel =& FLEA::getSingleton('table_SysHotel');
	}
	/**
	 * 城市列表
	 *
	 */
	function __FrontHotelAdminIndex()
	{
		$hotel = $this->hotel->findAll();
		$this->smarty->assign(
			array('hotel'=>$hotel)
		);
		dump($_SESSION);
		$this->smarty->display('admin/hotelindex.tpl');
	}
	/**
	 * 管理用户列表
	 *
	 */
	function __FrontAddAdminHotel()
	{
		if($_POST)
		{
			$this->city->save($_POST);
			redirect(url('AdminCity','CityIndex'));
		}
		$this->smarty->display('admin/addcity.tpl');
	}
	/**
	 * 改变用户状态 （禁用，启用）
	 *
	 */
	function __FrontEditAdminHotel()
	{
		if($_POST)
		{
			$this->city->save($_POST);
			redirect(url('AdminCity','CityIndex'));
		}
		if($_GET['city_id'])
		{
			$city = $this->city->find($_GET['city_id']);
			$this->smarty->assign(array(
				'city' => $city,
			));
		}
		$this->smarty->display('admin/addcity.tpl');
	}
	/**
	 * 改变城市状态 （禁用，启用）
	 *
	 */
	function __FrontDeleteAdminCity()
	{
		if($_GET['city_id']){
			if($_GET['state']==1)
			{
				$conditions = array(
					'city_id' => $_GET['city_id'],
					'delete'  => 0,
				);
			}
			else
			{
				$conditions = array(
					'city_id' => $_GET['city_id'],
					'delete'  => 1,
				);
			}
			$this->city->save($conditions);
			//$city = $this->city->removeByPkv($_GET['city_id']);
		}
		redirect(url('AdminCity','CityIndex'));
	}
}